博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
完成个人中心—导航标签
阅读量:4476 次
发布时间:2019-06-08

本文共 1096 字,大约阅读时间需要 3 分钟。

  • 个人中心—视图函数带标签页面参数tag @app.route('/usercenter/<user_id>/<tag>') def usercenter(user_id, tag):    if tag == ‘1':        return render_template('usercenter1.html', **context)
    @app.route('/usercenter/
    /
    ')@logindef usercenter(user_id,tag): user=User.query.filter(User.id == user_id).first() context = { 'username':user, # 'questions':user.questions, # 'comments':user.comments } if tag == 'user1': return render_template('user1.html', **context) elif tag=='user2': return render_template('user2.html', **context) else: return render_template('user3.html', **context)

     

  • 个人中心—导航标签链接增加tag参数 <li role=“presentation”><a href=“{
    { url_for(‘usercenter’,user_id = user.id,tag = ‘1’) }}">全部问答</a></li>
    {% block main %}     
    {% endblock %}

     

  • 个人中心—有链接到个人中心页面的url增加tag参数  <a href="{
    { url_for('usercenter',user_id = session.get('userid'), tag=1) }}">{
    { session.get('user') }}</a>

转载于:https://www.cnblogs.com/095lqt/p/8067887.html

你可能感兴趣的文章
python循环for,range,xrange;while
查看>>
hadoop的节点间的通信
查看>>
HashMap
查看>>
mysql 主从 重新同步
查看>>
论如何制做一个工程APP的测试内容
查看>>
如何通过Java启动linux脚本
查看>>
linux系统调用之网络管理2
查看>>
三种样式表插入方法
查看>>
hdu 2139 Calculate the formula (递推)
查看>>
mac, ios 模拟器
查看>>
双向宽度优先搜索
查看>>
常见的异常处理
查看>>
Linux基本命令参数
查看>>
Django系列(一)
查看>>
【ASP.NET Web API教程】2.3.3 创建Admin控制器
查看>>
第二类斯特林数
查看>>
Mysql
查看>>
JQuery中简约的进度条插件推荐
查看>>
url override and HttpSession implements session for form
查看>>
printf("\033[1;33m ***** \033[0m \n");
查看>>